package com.seckillpro.seckill_pro.controller;


import cn.hutool.core.util.ObjectUtil;
import com.seckillpro.seckill_pro.pojo.TUser;
import com.seckillpro.seckill_pro.service.ITOrderService;
import com.seckillpro.seckill_pro.service.ITSecKillOrderService;
import com.seckillpro.seckill_pro.vo.OrderDetailVo;
import com.seckillpro.seckill_pro.vo.RespBean;
import com.seckillpro.seckill_pro.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lyx
 * @since 2021-03-05
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private ITOrderService orderService;
    /**
     * @param user
     * @param orderId
     * @return
     */
    @RequestMapping("/orderDetail")
    @ResponseBody
    public RespBean detail(TUser user, Long orderId) {
        if(ObjectUtil.isEmpty(user)){
            return RespBean.error(RespBeanEnum.SESSION_ERROR);
        }
        OrderDetailVo detail = orderService.detail(orderId);
        return RespBean.success(detail);
    }

}
